* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 浅色模式变量 */
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f5f5f5;
    --text-primary: #222;
    --text-secondary: #666;
    --text-tertiary: #999;
    --border-color: #e0e0e0;
    --border-light: #e9ecef;
    --shadow-color: rgba(31, 38, 135, 0.37);
    --accent-color: #007bff;
    --accent-hover: #0056b3;
    --input-bg: #ffffff;
    --input-border: #ddd;
    --input-focus: #007bff;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #dc3545;
}

[data-theme="dark"] {
    /* 深色模式变量 */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #404040;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-tertiary: #888888;
    --border-color: #404040;
    --border-light: #333333;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --accent-color: #4dabf7;
    --accent-hover: #339af0;
    --input-bg: #2d2d2d;
    --input-border: #404040;
    --input-focus: #4dabf7;
    --success-color: #51cf66;
    --warning-color: #ffd43b;
    --error-color: #ff6b6b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    line-height: 1.4;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
}

.sidebar {
    width: 180px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 15px 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 15px 15px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 10px;
}

.sidebar-header h1 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-bottom: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background-color 0.15s;
    font-size: 13px;
    border-left: 2px solid transparent;
}

.nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active .nav-link {
    background: var(--accent-color);
    color: white;
    border-left-color: var(--accent-hover);
}

.nav-icon {
    font-size: 16px;
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

.nav-text {
    font-size: 14px;
}

.main-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: var(--bg-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 8px 32px var(--shadow-color);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8), rgba(118, 75, 162, 0.8));
    color: white;
    padding: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.15"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    z-index: 1;
}

h1 {
    margin: 0 0 20px 0;
    color: white;
    font-size: 2.8em;
    font-weight: 700;
    letter-spacing: -1px;
    position: relative;
    z-index: 2;
}

.input-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

.input-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.input-tab:hover {
    color: var(--accent-color);
}

.input-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.input-content {
    display: none;
    animation: fadeInUp 0.3s ease;
}

.input-content.active {
    display: block;
}

.tool-tabs {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.tab-button {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 14px 28px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 15px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.tab-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.tab-button:hover::before {
    left: 100%;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.tab-button.active {
    background: rgba(255, 255, 255, 0.95);
    color: #667eea;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.tool-content {
    display: none;
    padding: 15px 20px;
    animation: fadeInUp 0.6s ease-out;
}

.tool-content.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h2 {
    color: #222;
    margin-bottom: 15px;
    font-size: 18px;
    text-align: center;
    font-weight: 600;
}

h2::after {
    display: none;
}

h3 {
    color: #4a5568;
    margin-bottom: 25px;
    font-size: 1.4em;
    font-weight: 600;
}

.input-section, .settings-section {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    border: 1px solid var(--border-color);
}

.input-group {
    margin-bottom: 10px;
}

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 13px;
}

textarea, input, select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s;
    background: var(--input-bg);
    color: var(--text-primary);
}

textarea:focus, input:focus, select:focus {
    outline: none;
    border-color: var(--input-focus);
}

textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: end;
}

.form-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

.or-divider {
    text-align: center;
    margin: 20px 0;
    color: var(--text-secondary);
    font-weight: 600;
    position: relative;
}

.or-divider::before,
.or-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border-light);
}

.or-divider::before {
    left: 0;
}

.or-divider::after {
    right: 0;
}

.auto-generate {
    padding: 25px;
    background: var(--bg-secondary);
    border-radius: 15px;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 10px var(--shadow-color);
}

.example-text {
    margin-top: 15px;
    padding: 12px 15px;
    background: var(--bg-tertiary);
    border-left: 4px solid var(--accent-color);
    border-radius: 5px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.actions {
    display: flex;
    gap: 6px;
    margin: 12px 0;
    justify-content: center;
    flex-wrap: wrap;
}

.primary-btn, .secondary-btn {
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    margin-right: 6px;
}

.primary-btn {
    background: var(--accent-color);
    color: white;
}

.primary-btn:hover {
    background: var(--accent-hover);
}

.secondary-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
}

.results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.qr-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 3px var(--shadow-color);
}

.qr-code {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.qr-label {
    font-size: 13px;
    color: var(--text-secondary);
    word-break: break-all;
    margin-bottom: 8px;
    line-height: 1.3;
}

.qr-code {
    margin-bottom: 10px;
}

.qr-label {
    font-size: 14px;
    color: #666;
    word-break: break-all;
}

.string-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    flex-wrap: wrap;
}

.string-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    font-size: 14px;
    color: var(--text-secondary);
}

.string-tab:hover {
    color: var(--accent-color);
}

.string-tab.active {
    border-bottom-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: bold;
}

/* 主题切换样式 */
.header-with-toggle {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.header-with-toggle h1 {
    margin-bottom: 5px;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    color: var(--text-secondary);
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 4px;
    position: relative;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.theme-toggle[data-system="true"] {
    opacity: 0.7;
}

.theme-toggle[data-system="true"]:hover {
    opacity: 1;
}

[data-theme="dark"] .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle::after {
    content: "跟随系统";
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-secondary);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.theme-toggle[data-system="true"]:hover::after {
    opacity: 1;
}

[data-theme="dark"] .theme-icon.light {
    display: none;
}

[data-theme="light"] .theme-icon.dark {
    display: none;
}

.string-content {
    display: none;
}

.string-content.active {
    display: block;
}

/* 处理状态样式 */
.processing-loading {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.processing-stats {
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 10px;
    border-left: 3px solid var(--accent-color);
}

.result-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .string-tabs {
        flex-direction: column;
        gap: 5px;
    }
    
    .string-tab {
        padding: 8px 15px;
        text-align: left;
    }
}

/* 文本筛选工具样式 */
#text-filter {
    max-width: 1200px;
    margin: 0 auto;
}

.filter-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.filter-column {
    display: flex;
    flex-direction: column;
}

.filter-column label {
    font-weight: bold;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.line-counter {
    font-weight: normal;
    color: var(--text-secondary);
    font-size: 14px;
}

.filter-textarea {
    flex: 1;
    height: 200px;
    min-height: 200px;
    max-height: 400px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    resize: vertical;
    background: var(--input-bg);
    color: var(--text-primary);
}

.filter-options {
    margin: 15px 0;
    text-align: center;
}

.filter-options > label {
    font-weight: bold;
    margin-bottom: 10px;
    display: block;
    color: var(--text-primary);
}

.checkbox-group {
    display: flex;
    gap: 25px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 5px 0;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

.checkbox-group label:hover {
    color: #007bff;
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-actions button {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    min-width: 90px;
}

.filter-actions button:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.filter-actions .primary-btn {
    background: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: 600;
}

.filter-actions .primary-btn:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.filter-actions .swap-btn {
    background: #28a745;
    color: white;
    border-color: #28a745;
    font-weight: 600;
}

.filter-actions .swap-btn:hover {
    background: #1e7e34;
    border-color: #1e7e34;
}

.filter-actions .secondary-btn {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
    font-weight: 600;
}

.filter-actions .secondary-btn:hover {
    background: #5a6268;
    border-color: #545b62;
}

.filter-result {
    margin-top: 20px;
}

.filter-result h4 {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-stats {
    font-weight: normal;
    color: var(--text-secondary);
    font-size: 14px;
}

.result-textarea {
    background: var(--bg-secondary);
    height: 200px;
    min-height: 100px;
    max-height: 400px;
    font-size: 13px;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.processing-stats {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 10px;
    border-left: 3px solid #007bff;
    text-align: center;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .filter-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .filter-options {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .checkbox-group {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .filter-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .filter-actions button {
        width: 200px;
    }
    
    .filter-textarea {
        min-height: 400px;
    }
}

.checkbox-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 14px;
}

.options {
    margin: 20px 0;
}

.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    width: auto;
    margin: 0;
}

.result {
    margin-top: 20px;
}

.result textarea {
    background: white;
    margin-bottom: 10px;
}

.result button {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}

.result button:hover {
    background: #5a6fd8;
}

@media (max-width: 1200px) {
    .results {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 992px) {
    .results {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 15px;
    }
    
    header {
        padding: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .tool-content {
        padding: 20px;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-group {
        min-width: auto;
    }
    
    .actions {
        flex-direction: column;
        align-items: center;
    }
    
    .results {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .results {
        grid-template-columns: 1fr;
    }
}